
import React, { useEffect } from 'react';
import Defaults from './main/Defaults';
import Circular from './main/Circular';
import Transverse from './main/Transverse';
import Blend from './main/Blend';
import { useStateThemeConfig } from '/@/store/hooks/theme';
import { useNavigate } from 'react-router-dom';
import { useStateToken } from '/@/store/hooks/user';
import { message } from 'antd';
const IsLayout = (props: { is: string }) => {
  switch (props.is) {
    case 'default':
      return <Defaults></Defaults>;
    case 'circular':
      return <Circular></Circular>;
    case 'blend':
      return <Blend></Blend>;
    case 'transverse':
      return <Transverse></Transverse>;
    default:
      return <Defaults></Defaults>;
  }
};

const Layout = () => {
  const { layout } = useStateThemeConfig();
  const navigate = useNavigate();
  const IsLogin = useStateToken();
  //登录拦截
  useEffect(() => {
    if (IsLogin === '') {
      message.error('未登录');
      navigate('/login');
    }
  });
  return <IsLayout is={layout}></IsLayout>;
};
export default Layout;
